package com.har01d.lang.compiler.domain.variable;

import com.har01d.lang.compiler.domain.type.Type;
import com.har01d.lang.compiler.generator.ExpressionGenerator;
import com.har01d.lang.compiler.generator.StatementGenerator;

public class FieldReference implements Reference {

    private final String className;
    private final Field field;

    public FieldReference(String className, Field field) {
        this.className = className;
        this.field = field;
    }

    public String getClassName() {
        return className;
    }

    @Override
    public String getName() {
        return field.getName();
    }

    @Override
    public Type getType() {
        return field.getType();
    }

    @Override
    public void accept(ExpressionGenerator generator) {
        generator.generate(this);
    }

    @Override
    public void accept(StatementGenerator generator) {
        generator.generate(this);
    }

}
